package com.itdaan.portal.business.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.itdaan.portal.common.util.ApplicationProperty;

/**
 * ServletContext 监听器
 * @author www.itdaan.com
 *
 */
public class ApplicationListener implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent servletContextEvent) {
		ServletContext application = servletContextEvent.getServletContext();
		application.removeAttribute("version");
	}

	@Override
	public void contextInitialized(ServletContextEvent servletContextEvent) {
		ServletContext application = servletContextEvent.getServletContext();
		if(application.getAttribute("version") == null){//设置全局版本
			String version = ApplicationProperty.getProperty("version");
			application.setAttribute("version", version);
		}
	}

	
	
}
